package classifiers;

import draw.DrawPanel;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

public class MouseClickListener implements MouseListener {

    AbstractDoAction action;
    DrawPanel panel = null;
    
    public MouseClickListener(AbstractDoAction action, DrawPanel panel) {
        this.action = action;
        this.panel = panel;
    }

    @Override
    public void mouseClicked(MouseEvent me) {
        int x = me.getX();
        int y = me.getY();        

        action.doAction(x, y);
        if (action instanceof IsRepaint){
            panel.setSrcImage(((IsRepaint)action).getImage());
        }
    }

    @Override
    public void mousePressed(MouseEvent me) {
    }

    @Override
    public void mouseReleased(MouseEvent me) {
    }

    @Override
    public void mouseEntered(MouseEvent me) {
    }

    @Override
    public void mouseExited(MouseEvent me) {
    }
}
